@extends('Admin.Index.index')
@section('title')
    商品属性修改
@endsection

@section('content')
<div class="page-container">
    <form action="" method="post" class="form form-horizontal" id="form-user-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>商品类别：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box">
                    <select class="select" id="classify">
                        @foreach($c_data as $c_re)
                            <option value="{{$c_re->c_id}}">{{$c_re->c_name}}</option>
                        @endforeach
                    </select>
                </span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>
                商品属性名称：</label>
            <div class="formControls col-xs-6 col-sm-6">
                @foreach($p_data as $p_re)
                <input type="text" class="input-text" id="property_name" value="{{$p_re->p_name}}">
                    @endforeach
            </div>
        </div>
        <div class="row cl">
            <div class="col-9 col-offset-2">
                <button class="btn btn-primary radius" id="goods_property_update" type="button" >更改</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
    $(function(){
        $('#goods_property_update').click(function () {
            var classify_id = $('#classify').val();
            var property_name = $('#property_name').val();
            $.post('',{c_id:classify_id,p_name:property_name},function (e) {
                if(e.status)
                {
                    layer.msg('更改成功',{icon:6},function () {
                        window.parent.location.reload();
                    });
                }else {
                    layer.msg(e.info,{icon:5});
                }
            });
        });
    });
</script>
@endsection